import request from '@/utils/request'
const pubpar={
    tenant: "pico"
}
// 用户列表
export function getEmployeeList(query) {
    return request({
        url: '/adm/v1/employee/list',
        method: 'get',
        params: {...query,...pubpar}
    })
}
// 添加用户
export function addEmployee(data) {
    return request({
        url: '/adm/v1/employee/add',
        method: 'post',
        data: {...data,...pubpar}
    })
}

// 删除用户
export function deleteEmployee(id) {
    return request({
        url: `/adm/v1/employee/delete/${id}`,
        method: 'delete'
    })
}


// 角色列表
export function getPermissionRoleList(query) {
    return request({
        url: '/adm/v1/permissionRole/list',
        method: 'get',
        params: {
            name: query.name,
            page:1,
            pageSize: 30,
            ...pubpar
        }
    })
}
// 添加角色
export function addPermissionRoleList(data) {
    return request({
        url: '/adm/v1/permissionRole/add',
        method: 'post',
        data:{...data,...pubpar}
    })
}

// 查询权限列表/permissionResource/list
export function getPermissionResourceList() {
    return request({
        url: '/adm/v1/permissionResource/list',
        method: 'get',
        params: pubpar,
    })
}

export function addPermissionResource(data) {
    return request({
        url: '/adm/v1/permissionResource/add',
        method: 'post',
        data:{...data,...pubpar},
    })
}

// 删除订单 /permissionResource/delete/4

export function deletePermissionResource(id) {
    return request({
        url: `/adm/v1/permissionResource/delete/${id}`,
        method: 'delete'
    })
}

// 给角色组分配权限 /permissionRole/edit
export function editPermissionRole(data) {
    return request({
        url: `/adm/v1/permissionRole/edit`,
        method: 'put',
        data
    })
}

// 获取菜单
export function getResource() {
    return request({
        url: `/adm/v1/employee/getResource`,
        method: 'get',
        params:pubpar,
    })
}

// 给用户开启关闭权限 /employee/editStash
export function editStash(data) {
    return request({
        url: `/adm/v1/employee/editStash/${data.id}/${data.status}`,
        method: 'put'
    })
}

// 获取角色的权限
export function permissionRoleGetResource(id) {
    return request({
        url: `/adm/v1/permissionRole/getResource/${id}`,
        method: 'get',
        params:pubpar,
    })
}
// 删除角色 /permissionRole//delete/
export function deletePermissionRole(id) {
    return request({
        url: `/adm/v1/permissionRole/delete/${id}`,
        method: 'delete',
        params:pubpar
    })
}

// 获取用户按钮权限 /button/list

export function getButtonList() {
    return request({
        url: `/adm/v1/button/list`,
        method: 'get',
        params:pubpar
    })
}

export function addButtonList(data) {
    return request({
        url: `/adm/v1/button/add`,
        method: 'put',
        data:{...data,...pubpar}
    })
}

export function editRoleEmployee(data) {
    return request({
        url: `/adm/v1/employee/editRole`,
        method: 'put',
        data
    })
}
// /button/edit 
export function buttonEdit(data) {
    return request({
        url: `/adm/v1/button/edit`,
        method: 'put',
        data
    })
}

// 获取用户按钮权限
export function getButtonUser(data) {
    return request({
        url: `/adm/v1/button/getButton`,
        method: 'get',
        params:{...data,...pubpar},
    })
}

// 获取菜单/permissionRole/getButton/
export function permissionRoleGetButton(id) {
    return request({
        url: `/adm/v1/permissionRole/getButton/${id}`,
        method: 'get'
    })
}

// 修改密码
export function editPassword(data) {
    return request({
        url: `/adm/v1/employee/editPassword`,
        method: 'put',
        data
    })
}
// 删除按钮 /button/delete/
export function deleteButton(id) {
    return request({
        url: `/adm/v1/button/delete/${id}`,
        method: 'delete'
    })
}